package cn.wanho.mapper;

import cn.wanho.dto.ExamMenuRole;
import cn.wanho.dto.ExamRoles;
import cn.wanho.dto.ExamUser;
import cn.wanho.rvo.StudentInformatin;
import cn.wanho.rvo.TeacherRVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;
import java.util.UUID;

@Mapper
public interface ExamUserMapper {
    /**
     * delete by primary key
     * @param id primaryKey
     * @return deleteCount
     */
    int deleteByPrimaryKey(Long id);

    /**
     * insert record to table
     * @param record the record
     * @return insert count
     */
    int insert(ExamUser record);

    /**
     * insert record to table selective
     * @param record the record
     * @return insert count
     */
    /**excel获取user，存入数据库*/
    /**
     * @author zxy
     * @date 2022/8/5
     */
    int insertSelective(ExamUser record);

    /**
     * select by primary key
     * @param id primary key
     * @return object by primary key
     */
    ExamUser selectByPrimaryKey(Long id);

    /**
     * update record selective
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKeySelective(ExamUser record);

    /**
     * update record
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKey(ExamUser record);

    ExamUser selectUserByName(String userName);

    Integer insertAdmin(@Param(value = "parentId") Integer userId,
                    @Param(value = "userName") String userName,
                    @Param(value = "userPass") String encoderPass,
                    @Param(value = "salt") String salt);

    /**根据用户id去修改用户的信息*/
    int selectById(@Param("userName") String userName, @Param("userIcon") String userIcon, @Param("personInfo") String  personInfo, @Param("id") Long id);

    /**拿到当前用户的id去查询用户的信息*/
    ExamRoles selectUserInformation(@Param("userId") Long userId);


    /**根据当前学生的id去查询学生信息*/
    StudentInformatin selectStudentInformation(@Param("id")Long id);

    int updateUserById(@Param("userName") String userName, @Param("userIcon") String userIcon,
                   @Param("personInfo") String  personInfo, @Param("id") Long id);

    int updatePass(@Param(value = "oldPass")String oldPass,@Param(value = "newPass") String newPass,@Param(value = "userId") Integer userId,@Param("salt1") String salt1);

    ExamUser selectUserByuserId(Integer userId);

    List<ExamMenuRole> selectListByPath(String url);

    /**创建老师*/
    /**
     * @author zxy
     * @date 2022/8/5
     */
    Integer createTeacher(@Param(value = "parentId") Long id,@Param(value ="userName") String userName, @Param(value = "userPass") String newUserPass,@Param(value = "saltx") String salt);
    /**根据username查询老师*/
    /**
     * @author zxy
     * @date 2022/8/5
     */
    Integer queryTeacherByUserName(String userName);

    /**
     * @author zxy
     * @date 2022/8/5
     * 根据id判断权限
     */
    Integer judge(Long id);
    /**
     * @author zxy
     * @date 2022/8/5
     * 添加权限（2管理员3老师4学生）
     */
    Integer AddRoles(Integer userId,Integer rolesId);
    /**
     * @author zxy
     * @date 2022/8/5
     * 名字获取userId
     */
    Integer SelectUserIdByUserName(String userName);


    /** 获取传入的用户id所对应的权限组id */
    Integer selectRole(Integer id);

    /** 修改老师的状态 */
    Integer passTeacher(Integer tId);

    /** 查询所有用户的id */
    //List<Integer> selectId();

    /** 查询所有授课老师的信息 */
    List<TeacherRVO> queryAllTeacher();

}